<template>
  <div>
       <el-tree
        :data="data"
        :props="defaultProps"
        accordion
        @node-click="handleNodeClick">
        </el-tree>
  </div>
</template>

<script>
import axios from 'axios'
export default {
    data(){
        return{
            data: [],
        defaultProps: {
          chilsdren: 'chilsdren',
          label: 'label'
        },
        msg:{}
        }
    },
    methods:{
      handleNodeClick(data) {
        console.log(data);
        this.$emit('changepid',data.coding)
        
      },
        getlist1(){
          axios({url:'/deptlist',method:'get'}).then(res=>{
            console.log(res.data);
            this.data = res.data.list
          })
        },
        
    },
    mounted(){
        this.getlist1()
    }
}
</script>

<style>

</style>